go to previous page   go to home page   go to next page

Answer:

No, the disk file is a text file and contains only characters.


Summary of Class FileWriter

Here is a list of some of the constructors and methods used with FileWriter. All of the methods are inherited from its ancestors. For a complete list of methods look at the Java documentation on the Web.

When you write() characters to a file, you are asking the operating system to write to the disk. But the operating system might not do the work until later depending on how busy it is. The flush() method ensures that all data is actually sent to the disk.



Constructors

FileWriter(String fileName) 
   An IOException is thrown if the file cannot be created.
            
FileWriter(String fileName, boolean append)            
   An IOException is thrown if the file cannot be opened for appending.

Methods

public void close() throws IOException
    Flush the stream and close the file.

public void flush() throws IOException
    Flush the stream.

public void write(String str) throws IOException
    Write a string.

QUESTION 11:

Why not do a flush() after each write() to be sure that all the data is written to the disk?